package com.qs.strategy;

/**
 * ClassName: WxPayStrategy
 * Package: com.qs.strategy
 * Description:
 *
 * @Author: @weixueshi
 * @Create: 2024/8/3 - 12:53
 * @Version: v1.0
 */

import com.qs.pojo.entity.Pay;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.Map;

/**
 * 微信支付策略
 */
@Component
public class WxPayStrategy implements StrategyFactory {

    /**
     * 支付类型
     */
    private static final String PAY_TYPE = "wxPay";

    @Override
    public Map<String, Object> pay(Pay pay) {
        //具体支付实现逻辑
        System.out.println("微信支付" + pay.toString());
        return new HashMap<>();
    }

    /**
     * 注册微信支付策略方法
     * @throws Exception
     */
    @Override
    public void afterPropertiesSet() throws Exception {
        PayFactory.register(PAY_TYPE,this);
    }
}
